1. Field of the Invention
The present invention relates to a method of blending a plurality of pixels on a texture map and to a plural pixel blending circuit and image processing device using this.
2. Description of the Related Art
In recent years, image processing devices whereby the image of an object arranged in virtual three-dimensional space is displayed by a plurality of polygons using computer graphics techniques have become common. In addition, research and development is proceeding aimed at making the displayed object approach more closely to reality.
In this technical field of computer graphics, surface details of the displayed object are called "texture". The feeling of color/surface or material etc. is formed on the surface of the object by reading texture data from a texture map and mapping it onto each polygon pixel constituting the polygon in question.
FIG. 8 and FIG. 9 are views given in explanation of such mapping of texture data. Specifically, FIG. 8 is an example of a polygon stored in a frame buffer and deployed on to a two-dimensional co-ordinate plane in order to effect display on a display device such as a CRT display.
Such a polygon P as displayed has three vertices A, B, C; the respective vertices have, as vertex data, co-ordinates on the X, Y axes on a texture map that stores the texture data that is to be mapped.
For example, as the stored position of the texture map mapped onto the pixel of vertex A, as shown in FIG. 8, there are provided co-ordinate data (T.sub.xo, T.sub.yo) on the texture map of FIG. 9. Likewise, vertex B has co-ordinate data (T.sub.x1, T.sub.y1) and vertex C has co-ordinate data (T.sub.x2, T.sub.y2)
Furthermore, in regard to the pixel of point D on the edge line of vertex A and vertex B for example, the data (T.sub.xi, T.sub.yi) of co-ordinates D on the texture map are obtained as shown in FIG. 8 by linear or perspective interpolation of co-ordinate data (T.sub.xo, T.sub.yo) of vertex A and co-ordinate data (T.sub.x1, T.sub.y1) of vertex B.
The co-ordinate data on the texture map are likewise found by linear or perspective interpolation for all the other pixels constituting polygon P.
On the other hand, regarding the texture map, for each type of object texture, for example if the object is rock, data representing a rocky surface or if the object is wooden, data representing a wooden surface are deployed in map fashion and stored in a memory device. Specifically, this changes non-uniformly and with continuity such that the rocky surface on a single rock or the tree surface of a single tree can not be defined by a single data entry.
The texture map therefore consists in deployment of textures of for example a rocky surface or tree surface in the X, Y axis co-ordinate plane, the texture of a rocky surface or tree surface etc. at a corresponding specified position being found by specifying the X, Y axis co-ordinate position.
Let us now consider the relationship between the biaxial plane of a texture map shown in FIG. 10 and a polygon pixel. In FIG. 10, region 70 enclosed by the thick line is a range in which texture map co-ordinates are specified corresponding to one pixel constituting a polygon. Regions 71.about.74 are a plurality of pixels on the texture map. Consequently, in this region 70, texture based on the texture data read from the texture map is mapped on to the pixel in question.
However, one pixel constituting a polygon as described above does not necessarily correspond to a pixel of the texture map and a region 70 constituting a polygon and specified by one pixel may span a plurality of adjacent pixels of the texture map. In the example of FIG. 10, region 70 is overlaid on four adjacent pixels 71.about.74 of the texture map.
Consequently, for the texture in respect of one pixel constituting a polygon corresponding to region 70, the corresponding texture data is found by blending the data entries of four adjacent pixels 71.about.74 in accordance with the area overlaid in region 70.
However, in some cases it is necessary to represent a portion in which a hole is formed in part of the polygon. The texture data corresponding to the portion where this hole is formed is of the transparent coloration. Consequently, in this case, when mapping texture on to the polygon, transparent pixels will be included in the plurality of pixels corresponding to the polygon in question on the texture map that is blended therewith.
Care has therefore to be taken in effecting blending in such cases. The reason for this is that, if blending is effected at pixels that are adjacent to transparent coloration, there is a risk of abnormal color tone being produced.
If, when texture data of a plurality of pixels corresponding to an area are blended as described above, the colors of the pixels 71.about.74 of the texture map in FIG. 10 are respectively designated as color0, color1, color2, and color3, and color1 is transparent, a normalized calculation formula estimated from the contributions in accordance with the relevant area may be represented by Mathematical Expression (1) or Mathematical Expression (2). EQU Color={color0(1-x)(1-y)+color2(1-x).multidot.y+color3.multidot.x.multidot.y }/{(1-x)(1-y)+(1-x).multidot.y+x.multidot.y}.multidot. (1)
Or: EQU Color=color0(1-x)(1-y)+color1x(1-y)+color2(1-x)y+color3xy (2)
In Mathematical Expression 1, the calculation is performed excluding the data of pixel 72 of color1, which is transparent. In contrast, Mathematical Expression 2 is calculated including the data of pixel 72 of color1, which is transparent.
There are problems with the methods of calculation of both Mathematical Expression 1 and Mathematical Expression 2. In the former case, the color of pixels that are transparent can be neglected. However, the circuit layout to perform division is complicated.
On the other hand, in the case of the latter, though a circuit layout to perform division is not necessary, pixel 72, which ought to be transparent, is not excluded from the color blending process. In this case, transparent pixel 72 must also have color applied to it to match with the color of adjacent pixels on the texture map: this complicates the data processing.